<template>
  <div class="assets-dialog flex-center">
    <div class="dialog">
      <div class="head">
        <span>查看认证信息</span>
        <i class="iconfont iconguanbi" @click="$emit('cancel')"></i>
      </div>
      <div class="info-body flex-around">
        <img :src="info.image_url" @click="showImg=true;img=info.image_url" />
        <img
          :src="info.file_url"
          @click="showImg=true;img=info.file_url"
          v-if="info.file_type==='image'"
        />
        <video
          :src="info.file_url"
          class="video"
          controls="controls"
          v-if="info.file_type==='video'"
        ></video>
      </div>
      <el-button class="close" type="primary" size="medium" @click="$emit('cancel')">关闭</el-button>
    </div>
    <div class="bg" @click="$emit('cancel')"></div>
    <transition name="fade">
      <img-view :img="img" v-if="showImg" @cancel="showImg=false"></img-view>
    </transition>
  </div>
</template>
<script>
import ImgView from "@/components/Explorer/ImgView.vue";
export default {
  components: {
    ImgView
  },
  props: ["info"],
  data() {
    return {
      showImg: false,
      img: ""
    };
  }
};
</script>

<style lang="scss" scoped>
.assets-dialog,
.bg {
  z-index: 10;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}
.dialog {
  position: relative;
  z-index: 20;
  width: 800px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 1);
  box-shadow: 0px 0px 20px 0px rgba(61, 118, 249, 0.18);
  .iconguanbi {
    float: right;
    font-size: 18px;
    cursor: pointer;
  }
  .head {
    color: #606266;
    padding: 15px 25px;
    border-bottom: 1px solid #dcdfe6;
    span {
      font-size: 16px;
    }
  }
  .info-body {
    padding: 25px;
    min-height: 250px;
    img {
      max-width: 200px;
      cursor: pointer;
    }
    .video {
      max-width: 450px;
    }
  }
  .close {
    float: right;
    margin: 0 25px 18px 0;
  }
  .fade-enter-active,
  .fade-leave-active {
    transition: opacity 0.3s;
  }
  .fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
    opacity: 0;
  }
}
</style>

